import { ColumnProps } from '~/library/components/ProTable/interface'
import { Member } from '~/src/api/interface/member'
import { memberGradeDefault, memberGradeUpgrade } from '~/src/utils/serviceDict'

export const memberGradeColumns: ColumnProps<Member.MemberGrade>[] = [
  { type: 'selection', width: 80 },
  { type: 'index', label: '序号', width: 80 },
  { sortable: true, prop: 'title', label: '等级名称', align: 'left', search: { el: 'input' } },
  {
    sortable: true,
    prop: 'discountTypeName',
    label: '折扣类型',

    align: 'left',
  },
  {
    sortable: true,
    prop: 'isDefault',
    label: '是否默认',
    enum: memberGradeDefault,

    align: 'left',
    search: { el: 'select', props: { filterable: true } },
    fieldNames: { label: 'label', value: 'value' },
  },
  {
    sortable: true,
    prop: 'prioritySortId',
    label: '升级优先级',

    align: 'left',
  },
  {
    sortable: true,
    prop: 'isOpenUpgrade',
    label: '自动升级',
    enum: memberGradeUpgrade,

    align: 'left',
    search: { el: 'select', props: { filterable: true } },
    fieldNames: { label: 'label', value: 'value' },
  },
  { sortable: true, prop: 'rechargeAmount', label: '充值总金额', align: 'left' },
  { sortable: true, prop: 'expenditureMoney', label: '消费总金额', align: 'left' },
]
